    
#define SETRANDF(X, Y)    \
    {        \
        if (*(pRandFlag+X+1)==0)    (*pRandFlag)++;    \
        *(pRandFlag+X+1)=Y+1;    }
        
#define SETRANDMOREF(X, Y)    \
    {        \
        if (*(pRandMoreFlag+X+1)==0)    (*pRandMoreFlag)++;    \
        *(pRandMoreFlag+X+1)=Y+1;    }
        
#define ISENOUGH(x)    \
            \
        if ((KB_CODE) || x>400 || *pRandFlag>=RANDBURST*4/5) {*pRandFlag=0; CLRRANDF break ;}

#define CLRRANDF    \
    {    short i;    \
            \
        i=0;    \
        do{*(pRandFlag+i)=0; ++i;}while(i<RANDBURST+1);    }
        
#define CLRRANDMOREF    \
    {    short i;    \
            \
        i=0;    \
        do{*(pRandMoreFlag+i)=0; ++i;}while(i<RANDBURST+1);    }
        

extern "C" void RandProcess(void);
//extern "C" void RandProcess_falling(void);
extern "C" unsigned short *RandProcess2(unsigned short *ramaddr1, unsigned short *x1, unsigned short *x2);
extern "C" short pRandFlag[1000];
extern "C" short pRandMoreFlag[1000];
extern "C" void InitRand(void);
extern "C" short RandFindTp(short Width);
extern "C" unsigned char RANDBURST;
extern "C" short cp1,cp2;
extern "C" short cp1_real,cp2_real;
extern "C" unsigned char tempiProcFlag;

extern "C" short alterprocessflag;

extern "C" unsigned int    random_full;
#define    MAX_POINTS   40

#define RANDLENGTH    130

